using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using NCS.Module.CMS.Library;
using NCS.Module.CMS.Library.Definitions;
using NCS.Module.CMS.Library.Distributions;
using NCS.Library.Utilities;
using NCS.Module.CMS.Library.Contents;
using NCS.Module.CMS.Library.Events;

namespace NCS.Module.CMS.Web.Movies
{
    public partial class NewsInEventList : CMSWebControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            int eventid = ConvertUtility.ToInt32(Request.QueryString["eventid"]);

            EventInfo info = EventController.GetInfo(eventid);
            
            if(info != null)
            lblZoneName.Text = info.Event_Name;

            DataTable dtContents = EventController.Event_GetNewsByEventID(eventid, 100);
            grdContentList.DataSource = dtContents;
            grdContentList.RowDataBound += new GridViewRowEventHandler(grdContentList_RowDataBound);
            grdContentList.DataBind();
            
        }

        void grdContentList_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                DataRowView currow = (DataRowView)e.Row.DataItem;
                Label lbalias = (Label)e.Row.FindControl("lbalias");
                lbalias.Text = (ConvertUtility.ToString(currow["Content_Alias"]) == string.Empty ? "" : (currow["Content_Alias"].ToString() + "  ")) + ConvertUtility.ToDateTime(currow["Distribution_CreateDate"]).ToString("dd/MM/yyyy hh:mm:ss tt").Replace("SA", "AM").Replace("CH", "PM");
            }
        }       

    }
}